package com.class04.controller;

import com.class04.mapper.UserMapper;
import com.class04.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @ClassDescription:
 * @JdkVersion: 17
 * @Author: yxy
 * @Created: 2024/3/9 0:03
 */
@RestController
//@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserMapper userMapper;
    @GetMapping("/list")
    public List<User> queryList(){
        List<User> userList = userMapper.getUserList();
        List<User> collect = userList.stream().limit(2).
                collect(Collectors.toList());
        collect.stream().forEach(System.out::println);
        return collect;
    }

}
